/*
 * @Author: Zhang Yingying
 * @Date: 2020-12-03 21:19:35
 * @LastEditors: Zhang Yingying
 * @LastEditTime: 2020-12-03 21:42:48
 */
import { loginApi } from "@/api";

function fileToBase64(file) {
  return new Promise((resolve, reject) => {
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function() {
      resolve(this.result);
    };
    reader.onerror = function(err) {
      reject(err);
    };
  });
}

export function useUtils() {
  return {
    fileToBase64
  };
}

export function useApi() {
  return {
    loginApi
  };
}
